/**
 *
 *      ___                       ___
 *     /\  \          ___        /\  \
 *    /::\  \        /\  \      /::\  \
 *   /:/\:\  \       \:\  \    /:/\ \  \
 *  /:/  \:\  \      /::\__\  _\:\~\ \  \
 * /:/__/ \:\__\  __/:/\/__/ /\ \:\ \ \__\
 * \:\  \  \/__/ /\/:/  /    \:\ \:\ \/__/
 *  \:\  \       \::/__/      \:\ \:\__\
 *   \:\  \       \:\__\       \:\/:/  /
 *    \:\__\       \/__/        \::/  /
 *     \/__/                     \/__/
 *
 * CIS - Clang Indexing Service is a Project Manager & Source code indexing service
 * created so as to simplify the indexing of C/C++ based source code which use
 * standardized build mechanisms.
 *
 **/

#ifndef PROJECT_HXX
#define	PROJECT_HXX

#include "location.hxx"
#include "compilationdb.hxx"

#include <fstream>

#include <Poco/Mutex.h>
#include <Poco/SharedPtr.h>

namespace cis {

class Project {
private:
    std::string makeparams;
    std::string makefile;
    std::string buildpath;
    std::string name;

    Poco::SharedPtr<CompilationDB> compilationDB;
    Poco::Mutex mutex;
    mutable std::ofstream projectStream;

public:
    typedef Poco::SharedPtr<Project> ProjectPtr;

    Project(const std::string& name, const std::string& mf, const std::string makeparams);

    void build();

    bool hasCompilationErrors() const;

    void getDiagnostics();

    void getCompletionsAtLoc(const Location& loc);

    void getSymbolReferences(const Location& loc);

    void getAllSymbolReferences(const Location& loc);

    void getFileOutline(const std::string& file);

    void getOutline(const std::string& file);

    void getOutline();

    void getDeclaration();

    void getDefination();

    ~Project();

    friend class CompilationDB;
};

}


#endif	/* PROJECT_HXX */

